package practice;

import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;

public class MutilThread {
    public static void main(String[] args) {
        HashMapThread hashMapThread1 = new HashMapThread();
        HashMapThread hashMapThread2 = new HashMapThread();
        HashMapThread hashMapThread3 = new HashMapThread();
        HashMapThread hashMapThread4 = new HashMapThread();
        hashMapThread1.start();
        hashMapThread2.start();
        hashMapThread3.start();
        hashMapThread4.start();

    }

}
class HashMapThread extends Thread{
    private static AtomicInteger atomicInteger = new AtomicInteger();
    private static HashMap<Integer,Integer> map = new HashMap<>();
    @Override
    public void run(){
        while (atomicInteger.get()<1000000){
            map.put(atomicInteger.get(),atomicInteger.get());
            atomicInteger.incrementAndGet();
        }
    }
}